home *** CD-ROM | disk | FTP | other *** search
- /* Plot1D.m By Paul Kunz March 1992
- * Replacement of obsolete class used for backward compatiblity.
- *
- * Copyright (C) 1991 The Board of Trustees of
- * The Leland Stanford Junior University. All Rights Reserved.
- */
-
- #import "Plot1D.h"
-
- const char Plot1D_h_rcsid[] = PLOT1D_H_ID;
- const char Plot1D_m_rcsid[] = "$Id: Plot1D.m,v 1.64 1992/04/25 00:31:22 pfkeb Rel $";
-
- #import <objc/List.h>
- #import <objc/Storage.h>
- #import <appkit/nextstd.h>
-
- #define DEF_PLOT_SIZE 260.0
-
- @implementation Plot1D
-
- - init
- {
- [super init ];
- bounds.origin.x = 0.0;
- bounds.origin.y = 0.0;
- bounds.size.width = DEF_PLOT_SIZE;
- bounds.size.height = DEF_PLOT_SIZE;
- return self;
- }
- - replaceWithImage
- {
- id plot, plot2;
- cutStorElem cut;
- int i, count;
-
- plot = [[Plot allocFromZone:[self zone]] init];
- [plot setBounds:&bounds];
- [plot setHTuple:nil withDisplay:disp];
- [plot setRefFlag:refFlag];
- [plot setFixBinsFlag:fixBinsFlag];
- [plot setRefFilename:reffilename];
- [plot setCutHistFlag:cutHistFlag];
- if ( cutHistFlag ) {
- [plot setCutParms:&cutParms];
- }
- count = [cutPlotStor count];
- for ( i = 0; i < count; i ++ ) {
- cut.plot = [ cutPlotStor elementAt:i];
- [plot addCutPlot: cut.plot];
- }
- count = [dependList count];
- for ( i = 0; i < count; i ++ ) {
- plot2 = [dependList objectAt:i];
- [plot addCutDepend:plot2];
- }
- disp = NULL;
- [self free];
- return plot;
- }
-
- - read:(NXTypedStream *) ts
- {
- id plot;
- cutStorElem cut;
- ntuple *ntlist;
- display *dlist;
- char *data;
- int len, lenref;
- int i, count;
-
- [super read:ts];
- NXReadTypes( ts, "ccii", &refFlag, &fixBinsFlag, &len, &lenref);
- NX_ZONEMALLOC( [self zone], data, char, len );
- NX_ZONEMALLOC( [self zone], reffilename, char, lenref+1 );
- NXReadType( ts, "*", &reffilename);
- NXReadArray( ts, "c", len, data );
- h_readMem( data, len, &dlist, &ntlist );
- NXZoneFree( [self zone], data );
- disp = dlist[0];
- disp->ntuple = NULL;
- NXReadType( ts, "c", &cutHistFlag );
- if ( cutHistFlag ) {
- NXReadType( ts, "i", &len );
- NX_ZONEMALLOC( [self zone], cutParms.cutFunc, char, len+1 );
- NXReadType( ts, "{*iffi}", &cutParms );
- NXReadType( ts, "i", &cutNumber);
- }
- NXReadType( ts, "i", &count );
- if ( count ) {
- cutPlotStor = [[Storage allocFromZone:[self zone]] initCount:0
- elementSize:sizeof(cutStorElem)
- description:"@*"];
- }
- for ( i = 0; i < count; i++ ) {
- cut.plot = NXReadObject( ts );
- if ( cut.plot ) {
- [cutPlotStor addElement:&cut.plot];
- }
- }
- NXReadType( ts, "i", &count );
- if ( count ) {
- dependList = [[List allocFromZone:[self zone]] initCount:0];
- }
- for ( i = 0; i < count; i++ ) {
- plot = NXReadObject( ts );
- if ( plot ) {
- [dependList addObject:plot];
- }
- }
- return self;
- }
- - free
- {
- NXZoneFree([self zone], reffilename );
- NXZoneFree([self zone], cutParms.cutFunc );
- return [super free];
- }
- @end
-